package com.jd.sunny.java;

import java.util.Arrays;

/**
 * @Description:test Object
 * @author:sunlin
 * @since:12-11-27 18:31
 * @version:1.0.0
 */
public class TestObject {


    public static void main(String[] args){
        Employee employee1 =  new Employee();
        Employee employee2 =  new Employee();
        employee1.setName("sunlin");
        employee1.setSex("man");
        employee1.setCompany("jd");
        employee1.setSalary(2000);
        employee2.setName("sunlin");
        employee2.setSex("man");
        employee2.setCompany("jd");
        employee2.setSalary(2000);

        Person person = new Person();
        person.setName("sunlin");
        person.setSex("man");
        Teacher teacher = new Teacher();
        teacher.setName("sunlin");
        teacher.setSex("man");
        teacher.setTeachCourse("Math");

        boolean flag = employee1.equals(employee2);
        System.out.println("employee1==employee2 :" + flag);
        boolean f1 = person.equals(teacher);
        boolean f2 = teacher.equals(person);
        System.out.println("person==teacher :" + f1);
        System.out.println("teacher==person :" + f2);
        System.out.println("employee2.toString:" + employee2.toString());
        System.out.println("plus has the same meaning with toString:" + employee2);

        testArrayToString();
    }

    /**
     * test array toString() method
     */
    public static void testArrayToString(){
        int[] number ={1,2,3,4,5,6};
         System.out.println("object's toString,the array doesn't override the toString:" + number);
        System.out.println("Arrays's toString :" + Arrays.toString(number));
    }

}